package df.bean.db.table;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import df.bean.db.conn.DBConnection;

public class StpMethodAllocPayor extends ABSTable{
	 private Double price = 0d;
	    private Double normalAllocatePct = 0d;
	    private Double normalAllocateAmt = 0d;
	    private String remark = "";
	    private String hospitalCode = "";
	    private String doctorTreatmentCode = "";
	    private String admissionTypeCode = "";
	    private String doctorCategoryCode = "";
	    private String orderItemCategoryCode = "";
	    private String orderItemCode = "";
	    private String excludeTreatment = "";
	    private String taxTypeCode = "";
	    private String doctorCode = "";
	    private String guaranteeSource = "";
	    private String isAllocFulTax = "";
	    private String payorOfficeCode = "";
	    private String isPrivate = "";
	    private Double taxRate = 0d;

		static public final String EXCLUDE_YES = "Y";
	    static public final String EXCLUDE_NO = "N";
	    
	    public List priceArry = new ArrayList();
	    public List normalAllocatePctArry = new ArrayList();
	    public List normalAllocateAmtArry = new ArrayList();
	    public List remarkArry = new ArrayList();
	    public List hospitalCodeArry = new ArrayList();
	    public List doctorTreatmentCodeArry = new ArrayList();
	    public List admissionTypeCodeArry = new ArrayList();
	    public List doctorCategoryCodeArry = new ArrayList();
	    public List orderItemCategoryCodeArry = new ArrayList();
	    public List orderItemCodeArry = new ArrayList();
	    public List excludeTreatmentArry = new ArrayList();
	    public List taxTypeCodeArry = new ArrayList();
	    public List doctorCodeArry = new ArrayList();
	    public List guaranteeSourceArry = new ArrayList();
	    public List isAllocFulTaxArry = new ArrayList();
	    public List payorOfficeCodeArry = new ArrayList();
	    public List taxRateArry = new ArrayList();
	    public List isPrivateArry = new ArrayList();


		public StpMethodAllocPayor() {
	        
	    }
		public String getIsPrivate() {
			return isPrivate;
		}
		public void setIsPrivate(String isPrivate) {
			this.isPrivate = isPrivate;
		}
		public Double getTaxRate() {
			return taxRate;
		}
		public void setTaxRate(Double taxRate) {
			this.taxRate = taxRate;
		}
		public String getPayorOfficeCode() {
			return payorOfficeCode;
		}
		public void setPayorOfficeCode(String payorOfficeCode) {
			this.payorOfficeCode = payorOfficeCode;
		}
	    public String getIsAllocFullTax() {
			return isAllocFulTax;
		}
		public void setIsAllocFulTax(String isAllocFulTax) {
			this.isAllocFulTax = isAllocFulTax;
		}
		public List getIsAllocFulTaxArry() {
			return isAllocFulTaxArry;
		}
		public void setIsAllocFulTaxArry(List isAllocFulTaxArry) {
			this.isAllocFulTaxArry = isAllocFulTaxArry;
		}
	    public String getAdmissionTypeCode() {
	        return this.admissionTypeCode;
	    }

	    public String getDoctorCategoryCode() {
	        return this.doctorCategoryCode;
	    }

	    public String getDoctorTreatmentCode() {
	        return this.doctorTreatmentCode;
	    }

	    public String getHospitalCode() {
	        return this.hospitalCode;
	    }

	    public Double getNormalAllocateAmt() {
	        return this.normalAllocateAmt;
	    }

	    public Double getNormalAllocatePct() {
	        return this.normalAllocatePct;
	    }

	    public String getOrderItemCode() {
	        return this.orderItemCode;
	    }

	    public Double getPrice() {
	        return this.price;
	    }

	    public String getRemark() {
	        return this.remark;
	    }

	    public void setAdmissionTypeCode(String admissionTypeCode) {
	        this.admissionTypeCode = admissionTypeCode;
	    }

	    public void setDoctorCategoryCode(String doctorCategoryCode) {
	        this.doctorCategoryCode = doctorCategoryCode;
	    }

	    public void setDoctorTreatmentCode(String doctorTreatmentCode) {
	        this.doctorTreatmentCode = doctorTreatmentCode;
	    }

	    public void setHospitalCode(String hospitalCode) {
	        this.hospitalCode = hospitalCode;
	    }

	    public void setNormalAllocateAmt(Double normalAllocateAmt) {
	        this.normalAllocateAmt = normalAllocateAmt;
	    }

	    public void setNormalAllocatePct(Double normalAllocatePct) {
	        this.normalAllocatePct = normalAllocatePct;
	    }

	    public void setOrderItemCode(String orderItemCode) {
	        this.orderItemCode = orderItemCode;
	    }

	    public void setPrice(Double price) {
	        this.price = price;
	    }

	    public void setRemark(String remark) {
	        this.remark = remark;
	    }
	    
	    public String getOrderItemCategoryCode() {
			return orderItemCategoryCode;
		}
		public void setOrderItemCategoryCode(String orderItemCategoryCode) {
			this.orderItemCategoryCode = orderItemCategoryCode;
		}
		
		public void resetData() {
	    	this.setAdmissionTypeCode("");
	    	this.setDoctorCategoryCode("");
	    	this.setDoctorCode("");
	    	this.setDoctorTreatmentCode("");
	    	this.setExcludeTreatment("");
	    	this.setGuaranteeSource("");
	    	this.setIsAllocFulTax("");
	    	this.setIsPrivate("");
	    	this.setNormalAllocateAmt(0d);
	    	this.setNormalAllocatePct(0d);
	    	this.setOrderItemCategoryCode("");
	    	this.setOrderItemCode("");
	    	this.setPayorOfficeCode("");
	    	this.setPrice(0d);
	    	this.setTaxRate(0d);
	    	this.setTaxTypeCode("");
	    }
	    
    public boolean IsFound(String payorOfficeCode,String doctorTreatmentCode, String hospitalCode, String doctorCategoryCode,String orderItemCategoryCode, String orderItemCode, String admissionTypeCode, String isPrivate) {
        boolean ret = false;
        if(payorOfficeCode != null || payorOfficeCode != ""){
        String sql = "select * from STP_METHOD_ALLOC_PAYOR where " +
                                                " DOCTOR_TREATMENT_CODE='" + doctorTreatmentCode + "'" +
                                                " and HOSPITAL_CODE='" + hospitalCode + "'" +
                                                " and DOCTOR_CATEGORY_CODE='" + doctorCategoryCode + "'" +
                                                " and ORDER_ITEM_CODE='" + orderItemCode + "'" +
                                                " and ADMISSION_TYPE_CODE='" + admissionTypeCode + "'" +
                                                " AND ACTICE = '1'";
        	this.setResultSet(this.getDBConnection().executeQuery(sql));
            try {
                while (this.getResultSet().next()) {
                    ret = true;
                }
            } catch (SQLException e) {
                // TODO
                e.printStackTrace();
            } finally {
               //Clean up resources, close the connection.
               if(this.getResultSet() != null) {
                  try {
                     this.getResultSet().close();
                     this.setResultSet(null);
                    }
                  catch (Exception ignored) { ignored.printStackTrace();   }
            }
        }
        }
        return ret;
    }
    
    public String getExcludeTreatment() {
        return excludeTreatment;
    }

    public void setExcludeTreatment(String excludeTreatment) {
        this.excludeTreatment = excludeTreatment;
    }

    public String getTaxTypeCode() {
        return taxTypeCode;
    }

    public void setTaxTypeCode(String taxTypeCode) {
        this.taxTypeCode = taxTypeCode;
    }
    
    public String getDoctorCode() {
        return doctorCode;
    }

    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }

    public String getGuaranteeSource() {
        return guaranteeSource;
    }

    public void setGuaranteeSource(String guaranteeSource) {
        this.guaranteeSource = guaranteeSource;
    }
    
    
    // ============================= select all of table method allocation ===============================//
    public void clearAllArry() {
        this.priceArry.clear();
        this.normalAllocatePctArry.clear();
        this.normalAllocateAmtArry.clear();
        this.remarkArry.clear();
        this.hospitalCodeArry.clear();
        this.doctorTreatmentCodeArry.clear();
        this.admissionTypeCodeArry.clear();
        this.doctorCategoryCodeArry.clear();
        this.orderItemCodeArry.clear();
        this.excludeTreatmentArry.clear();
        this.taxTypeCodeArry.clear();
        this.doctorCodeArry.clear();
        this.guaranteeSourceArry.clear();
        this.isPrivateArry.clear();
        this.taxRateArry.clear();
        this.isAllocFulTaxArry.clear();
        this.orderItemCategoryCodeArry.clear();
    }
    public StpMethodAllocPayor(String doctorTreatmentCode, String hospitalCode, String doctorCategoryCode, String orderItemCode, String admissionTypeCode, String isPrivate, DBConnection conn) {
//        super("", doctorTreatmentCode, hospitalCode, doctorCategoryCode, admissionTypeCode, conn);
        super();
        this.setDBConnection(conn);
        this.setResultSet(this.getDBConnection().executeQuery("select * from STP_METHOD_ALLOC_PAYOR where " +
                                                " DOCTOR_TREATMENT_CODE='" + doctorTreatmentCode + "'" +
                                                " and HOSPITAL_CODE='" + hospitalCode + "'" +
                                                " and ADMISSION_TYPE_CODE='" + admissionTypeCode + "'" +
                                                " AND ACTIVE = '1'" ));
            try {
                while (this.getResultSet().next()) {
                    this.setPrice( this.getResultSet().getDouble("Price") );
                    this.setNormalAllocatePct(this.getResultSet().getDouble("Normal_Allocate_Pct"));
                    this.setNormalAllocateAmt (this.getResultSet().getDouble("Normal_Allocate_Amt"));
                    this.setRemark (this.getResultSet().getString("Remark"));
                    this.setHospitalCode (this.getResultSet().getString("HOSPITAL_CODE"));
                    this.setDoctorTreatmentCode (this.getResultSet().getString("DOCTOR_TREATMENT_CODE"));
                    this.setAdmissionTypeCode (this.getResultSet().getString("ADMISSION_TYPE_CODE"));
                    this.setPayorOfficeCode (this.getResultSet().getString("PAYOR_OFFICE_CODE"));
                    this.setOrderItemCategoryCode (this.getResultSet().getString("ORDER_ITEM_CATEGORY_CODE")); 
                    this.setOrderItemCode (this.getResultSet().getString("ORDER_ITEM_CODE")); 
                    this.setExcludeTreatment (this.getResultSet().getString("EXCLUDE_TREATMENT")); 
                    this.setTaxTypeCode (this.getResultSet().getString("TAX_TYPE_CODE"));
                    this.setDoctorCode(this.getResultSet().getString("DOCTOR_CODE"));
                    this.setGuaranteeSource(this.getResultSet().getString("GUARANTEE_SOURCE"));
                    this.setTaxRate(Double.parseDouble(this.getResultSet().getString("TAX_RATE")));
                    this.setIsPrivate(this.getResultSet().getString("IS_PRIVATE"));
                    this.setIsAllocFulTax(this.getResultSet().getString("IS_ALLOC_FULL_TAX"));
                }
            } catch (SQLException e) {
                // TODO
            	System.out.println("e = " + e);
                e.printStackTrace();
            } finally {
               //Clean up resources, close the connection.
               if(this.getResultSet() != null) {
                  try {
                     this.getResultSet().close();
                     this.setResultSet(null);
                    }
                  catch (Exception ignored) { ignored.printStackTrace();   }
            }
        }
    }


    public StpMethodAllocPayor(String hospitalCode, DBConnection conn) {
        super();
        this.setDBConnection(conn);
        this.setResultSet(this.getDBConnection().executeQuery("select * from STP_METHOD_ALLOC_PAYOR where HOSPITAL_CODE='" + hospitalCode +
        														"' AND ACTIVE = '1' AND ORDER_ITEM_CODE != 'ALL' " +
        														"UNION " +
        														"SELECT * FROM STP_METHOD_ALLOC_PAYOR where HOSPITAL_CODE='" + hospitalCode +
        														"' AND ACTIVE = '1' AND ORDER_ITEM_CODE = 'ALL'" 
        														));
            try {
                this.clearAllArry();
                
                while (this.getResultSet().next()) {
                    this.priceArry.add(this.getResultSet().getDouble("Price"));
                    this.normalAllocatePctArry.add(this.getResultSet().getDouble("Normal_Allocate_Pct"));
                    this.normalAllocateAmtArry.add(this.getResultSet().getDouble("Normal_Allocate_Amt"));
                    if (this.getResultSet().getString("PAYOR_OFFICE_CODE") == null ) { this.payorOfficeCodeArry.add(""); } else { this.payorOfficeCodeArry.add(this.getResultSet().getString("PAYOR_OFFICE_CODE")); }
                    if (this.getResultSet().getString("Remark") == null ) { 
                    	this.remarkArry.add(""); 
                    } else { 
                    	this.remarkArry.add(this.getResultSet().getString("Remark")); 
                    }
                    
                    if (this.getResultSet().getString("HOSPITAL_CODE") == null ) { this.hospitalCodeArry.add(""); } else { this.hospitalCodeArry.add(this.getResultSet().getString("HOSPITAL_CODE")); }
                    if (this.getResultSet().getString("DOCTOR_TREATMENT_CODE") == null ) { this.doctorTreatmentCodeArry.add(""); } else { this.doctorTreatmentCodeArry.add(this.getResultSet().getString("DOCTOR_TREATMENT_CODE")); }
                    if (this.getResultSet().getString("ADMISSION_TYPE_CODE") == null ) { this.admissionTypeCodeArry.add(""); } else { this.admissionTypeCodeArry.add(this.getResultSet().getString("ADMISSION_TYPE_CODE")); }
                    if (this.getResultSet().getString("ORDER_ITEM_CODE") == null ) { this.orderItemCodeArry.add(""); } else { this.orderItemCodeArry.add(this.getResultSet().getString("ORDER_ITEM_CODE")); }
                    if (this.getResultSet().getString("ORDER_ITEM_CATEGORY_CODE") == null ) { this.orderItemCategoryCodeArry.add(""); } else { this.orderItemCategoryCodeArry.add(this.getResultSet().getString("ORDER_ITEM_CATEGORY_CODE")); }
                    if (this.getResultSet().getString("DOCTOR_CATEGORY_CODE") == null ) { this.doctorCategoryCodeArry.add(""); } else { this.doctorCategoryCodeArry.add(this.getResultSet().getString("DOCTOR_CATEGORY_CODE")); }
                    if (this.getResultSet().getString("EXCLUDE_TREATMENT") == null ) { this.excludeTreatmentArry.add(""); } else { this.excludeTreatmentArry.add(this.getResultSet().getString("EXCLUDE_TREATMENT")); }
                    if (this.getResultSet().getString("TAX_TYPE_CODE") == null ) { this.taxTypeCodeArry.add(""); } else { this.taxTypeCodeArry.add(this.getResultSet().getString("TAX_TYPE_CODE")); }
                    if (this.getResultSet().getString("DOCTOR_CODE") == null ) { this.doctorCodeArry.add(""); } else { this.doctorCodeArry.add(this.getResultSet().getString("DOCTOR_CODE")); }
                    if (this.getResultSet().getString("GUARANTEE_SOURCE") == null ) { this.guaranteeSourceArry.add(""); } else { this.guaranteeSourceArry.add(this.getResultSet().getString("GUARANTEE_SOURCE")); }
                    if (this.getResultSet().getString("IS_ALLOC_FULL_TAX") == null ) { this.isAllocFulTaxArry.add(""); } else { this.isAllocFulTaxArry.add(this.getResultSet().getString("IS_ALLOC_FULL_TAX")); }
                    if (this.getResultSet().getString("TAX_RATE") == null ) { this.taxRateArry.add(""); } else { this.taxRateArry.add(this.getResultSet().getDouble("TAX_RATE")); }
                    if (this.getResultSet().getString("IS_PRIVATE") == null ) { this.isPrivateArry.add(""); } else { this.isPrivateArry.add(this.getResultSet().getString("IS_PRIVATE")); }
                    
                }
            } catch (SQLException e) {
                // TODO
                e.printStackTrace();
            } finally {
               //Clean up resources, close the connection.
               if(this.getResultSet() != null) {
                  try {
                     this.getResultSet().close();
                     this.setResultSet(null);
                    }
                  catch (Exception ignored) { ignored.printStackTrace();   }
            }
        }
    }

    public boolean IsFound(String payorOfficeCode,String doctorTreatmentCode, String orderItemCategoryCode, String orderItemCode, String doctorCategoryCode, String admissionTypeCode,String isPrivate) {
        boolean ret = false;
        for (int i=0; i<this.priceArry.size(); i++) {
            if (this.payorOfficeCodeArry.get(i).toString().equals( payorOfficeCode.toString()) &&
            		this.doctorTreatmentCodeArry.get(i).toString().equals( doctorTreatmentCode.toString()) &&
                    this.isPrivateArry.get(i).toString().equals(isPrivate.toString()) &&
                    this.doctorCategoryCodeArry.get(i).toString().equals(doctorCategoryCode.toString()) &&
                    this.admissionTypeCodeArry.get(i).toString().equals( admissionTypeCode.toString())) {
            	
            		System.out.println("In Allcoate Payor"+"orderItemCategoryCode = " + orderItemCategoryCode);
            	
            		if(this.orderItemCodeArry.get(i).toString().equals(orderItemCode.toString()) ){          	
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setOrderItemCode( this.orderItemCodeArry.get(i).toString() );
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
	            	}else if(this.orderItemCodeArry.get(i).toString().equals("ALL")){
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setOrderItemCode( this.orderItemCodeArry.get(i).toString() );
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
	            	}else{
	                    ret = false;
	            	}
                    
                break;
            }
        }
        return ret;
    }
    public boolean IsFound(String payorOfficeCode, String doctorTreatmentCode,String orderItemCategoryCode, String orderItemCode, String doctorCategoryCode, String admissionTypeCode, String isPrivate, Double price) {
        boolean ret = false; 
        for (int i=0; i<this.priceArry.size(); i++) {
            if (this.payorOfficeCodeArry.get(i).toString().equals( payorOfficeCode.toString()) &&
            		this.doctorTreatmentCodeArry.get(i).toString().equals(doctorTreatmentCode) &&
                    this.admissionTypeCodeArry.get(i).toString().equals(admissionTypeCode) &&
                    this.isPrivateArry.get(i).toString().equals(isPrivate) &&
                    this.doctorCategoryCodeArry.get(i).toString().equals(doctorCategoryCode.toString()) )
                    // && this.priceArry.get(i).toString().equals(price.toString()) ) 
                    {
            	
            	//System.out.println("In Allcoate Payor IsFound2 "+"orderItemCategoryCode = " + orderItemCategoryCode);
            	
        		if(this.orderItemCodeArry.get(i).toString().equals(orderItemCode.toString()) ){
        			if(this.orderItemCategoryCodeArry.get(i).toString().equals(orderItemCategoryCode.toString())){
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setOrderItemCode( this.orderItemCodeArry.get(i).toString() );
	                    this.setOrderItemCode(this.orderItemCategoryCodeArry.get(i).toString());
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
        			}else{
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setOrderItemCode( this.orderItemCodeArry.get(i).toString() );
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
        			}
            	}else if(this.orderItemCodeArry.get(i).toString().equals("")){
            		if(this.orderItemCategoryCodeArry.get(i).toString().equals(orderItemCategoryCode.toString())){
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setOrderItemCode(this.orderItemCategoryCodeArry.get(i).toString());
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
            		}else{
	                    this.setPrice( Double.parseDouble(this.priceArry.get(i).toString()) );
	                    this.setNormalAllocatePct( Double.parseDouble(this.normalAllocatePctArry.get(i).toString()) );
	                    this.setNormalAllocateAmt( Double.parseDouble(this.normalAllocateAmtArry.get(i).toString()) );
	                    this.setRemark( this.remarkArry.get(i).toString() );
	                    this.setHospitalCode( this.hospitalCodeArry.get(i).toString() );
	                    this.setDoctorTreatmentCode( this.doctorTreatmentCodeArry.get(i).toString() );
	                    this.setAdmissionTypeCode( this.admissionTypeCodeArry.get(i).toString() );
	                    this.setPayorOfficeCode( this.payorOfficeCodeArry.get(i).toString() );
	                    this.setDoctorCategoryCode( this.doctorCategoryCodeArry.get(i).toString() );
	                    this.setExcludeTreatment( this.excludeTreatmentArry.get(i).toString() );
	                    this.setTaxTypeCode( this.taxTypeCodeArry.get(i).toString() );
	                    this.setDoctorCode( this.doctorCodeArry.get(i).toString() );
	                    this.setGuaranteeSource( this.guaranteeSourceArry.get(i).toString() );
	                    this.setIsAllocFulTax( this.isAllocFulTaxArry.get(i).toString() );
	                    this.setTaxRate(Double.parseDouble(this.taxRateArry.get(i).toString()));
	                    ret = true;
	                    break;
            		}
            	}
            }
        }
        return ret;
    }
}
